<!--
 * @Author: your name
 * @Date: 2020-11-18 15:48:01
 * @LastEditTime: 2020-11-23 16:20:04
 * @LastEditors: Please set LastEditors
 * @Description: In User Settings Edit
 * @FilePath: \wms2\src\views\components\warehouseSpaceElSelect.vue
-->
<template>
<div>
  <el-autocomplete class="inline-input" v-model="state1" placeholder="请输入内容" :fetch-suggestions="querySearch" :trigger-on-focus="false" @select="handleSelect" >   
  </el-autocomplete>
</div>
</template>

<script>
  import request from '@/utils/request'
  export default {
    data() {
      return {
        value: '',
        location: '',
        state1:'',
        locationData:{}
      }
    },
    created() {

    },
    mounted() {

    },
    methods: {
      handleSelect(value) {
        this.locationData = value
        this.state1 = value.value
        this.$emit("setLocationCode",value)
      },
      listInventory(data, pageChange) {
        if (!pageChange) {
          this.paramsData = data;
        }
        const paramsData = Object.assign(this.paramsData, this.listQuery)
        this.loading = true;
        this.isDisable=true;   //确定键显示按钮
        request({
          url: '/wms/counting/inventory',
          method: 'get',
          params: paramsData
        }).then(response => {
          // console.log("response",1,response);
        })
      },
      querySearch(queryString, cb) {   
        let params = {
          pageSize: 99,
          locationName: queryString
        }
        request({
          url: '/wms/location/chooseDataLimit',
          method: 'get',
          params: params
        }).then(response => {
           for(var i=0;i<response.data.records.length;i++){
            response.data.records[i].value = response.data.records[i].serialNumber;   
          }
          cb(response.data.records);
        })
      }
    }
  }
</script>
